package org.sems.sems.Controller;

import org.sems.sems.entity.DataXsjlk;
import org.sems.sems.entity.Jlpjk;
import org.sems.sems.service.XsjlkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.util.Map;

@RestController
@RequestMapping("/xsjlk")
public class DataXsjlkController {

    @Autowired
    private XsjlkService xsjlkService;

    // 获取指定学生的简历信息--只获取发布的简历信息
    @GetMapping("/getStuResumeByStuId")
    public Map<String, Object> getStuResumeByStuId(int stuId) {return xsjlkService.getStuResumeByStuId(stuId);}


    @GetMapping("/getXsjlDataAuto")
    public Map<String, Object> getXsjlDataAuto(String YHM,int JLDM,int YHSFDM) {return xsjlkService.getXsjlDataAuto(YHM,JLDM,YHSFDM);}

    // 新建简历
    @PostMapping("/addResume")
    public Map<String,Object> addResume(DataXsjlk dataXsjlk){
        return    xsjlkService.addResume(dataXsjlk);
    }

    // 简历图片上传接口
    @PostMapping("/uploadImg")
    public Map<String, Object> uploadDwZpggkImg(MultipartFile file) {
        return xsjlkService.uploadXSJLKkImg(file);
    }

    @PostMapping("/uploadJlfj")
    public Map<String, Object> uploadJlfj(int jldm, MultipartFile file) {
     return   xsjlkService.uploadJlfj(jldm, file);
    }

    // 更新简历
    @PostMapping("/updateResume")
    public Map<String,Object> updateResume(DataXsjlk dataXsjlk){
        return    xsjlkService.updateResume(dataXsjlk);
    }

    // 获取简历评价列表
    @GetMapping("/getJpgjList")
    public Map<String,Object> getJpgjList(String YHM,int JLDM,int YHSFDM){
        return    xsjlkService.getJpgjList(YHM,JLDM,YHSFDM);
    }


    // 新增简历评价
    @PostMapping("/addJpgj")
    public Map<String,Object> addJpgj(Jlpjk jlpjk){
        System.out.println(jlpjk);
        return    xsjlkService.addJpgj(jlpjk);
    }
    // 更新简历评价
    @PostMapping("/updateJpgj")
    public Map<String,Object> updateJpgj(Jlpjk jlpjk){
        return    xsjlkService.updateJpgj(jlpjk);
    }

    // 撤销简历提交
    @GetMapping("/csSubmit")
    public Map<String,Object> csSubmit(int JLDM){
        return xsjlkService.csSubmit(JLDM);
    }
}
